<?php
namespace Admin\Controller;
use Common\Controller\AdminBaseController;
/**
 * 后台首页控制器
 */
class OtherController extends AdminBaseController{
    /**
     * 首页
     */
    public function index(){
        $set = $res = M("other_set")->where("id=1")->find();
        $this->assign('setting',$set);
        $this->display();
    }
    /**
     * elements
     */
    public function save(){

        $beganTime = $_POST['beganTime'];
        $endTime = $_POST['endTime'];
        if(!$beganTime){
            $this->error("请输入正确的开始时间");
        }
        if(!$endTime){
            $this->error("请输入正确的结束时间");
        }
        $dateArr = array();
        $dateArr['beganTime'] = $beganTime;
        $dateArr['endTime'] = $endTime;
        $dateArr['id'] = 1;
        $res = M("other_set")->save($dateArr);
        if($res==true){
            $this->success("保存成功");
        }else{
            $this->success("保存失败");
        }
    }

    /**
     * welcome
     */
    public function welcome(){
        $this->display();
    }



}
